package neptune.web.server.operations;

import neptune.web.server.ApplicationManager;
import it.robertobifulco.ias.IncorrectParamsException;
import it.robertobifulco.ias.Operation;

public class RemovePhysicalMachine implements Operation {

	public static String ID = "RemovePhysicalMachine";

	public Object[] execute(Object[] args) throws IncorrectParamsException,
			Exception {
		String idPhysicalMachine = (String) args[0];
		boolean result = ApplicationManager.getApplicationManager()
				.getNeptuneManager().removePhysicalMachine(idPhysicalMachine);
		if (result) {
			return new Object[] { idPhysicalMachine };
		} else {
			return null;
		}

	}

	public String getDescription() {
		return "Remove a physical machine from the cluster";
	}

	public String getID() {
		return ID;
	}

}
